import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/api/roles/list',
    method: 'get',
    params: query
  })
}

export function all() {
  return request({
    url: '/api/roles/all',
    method: 'get'
  })
}

export function updateRole(){

}

export function detail(id) {
  return request({
    url: '/api/roles/detail',
    method: 'get',
    params: { id }
  })
}

export function roles_detail(id) {
  return request({
    url: '/api/roles/roles_detail',
    method: 'get',
    params: {
      id : id
    }
  })
}



export function submitRoles(id,roles) {
  return request({
    url: '/api/roles/save_roles',
    method: 'post',
    data:{
      id:id,
      roles:roles
    }
  })
}

export function del(id) {
  return request({
    url: '/api/roles/del',
    method: 'get',
    params: { id }
  })
}

export function fetchPv(pv) {
  return request({
    url: '/vue-element-admin/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function create(data) {
  return request({
    url: '/api/roles/create',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return request({
    url: '/vue-element-admin/article/update',
    method: 'post',
    data
  })
}
